<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<!DOCTYPE html >
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>USER</title>
    <link rel="stylesheet" type="text/css"
          href="easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
    <script type="text/javascript" src="myjs/path.js"></script>
    <script type="text/javascript" src="easyui/jquery.min.js"></script>
    <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src='myjs/vip.js'></script>
    <script src="js/yangshi.js"></script>

</head>
<body>
<shiro:lacksPermission name="vip:look">没有查询此模块权限。。。</shiro:lacksPermission>
<shiro:hasPermission name="vip:look">
    <div id="tb" style="padding: 5px; height: auto"
         style="padding-bottom:20px;background:#eee;">
        <div style="margin-bottom: 5px">
            <!-- <shiro:hasPermission name="vip:create"><a href="#" class="easyui-linkbutton" iconCls="icon-add"
                plain="true" onclick="openWin()">新增会员</a></shiro:hasPermission> -->
            <!-- <shiro:hasPermission name="vip:update"><a href="#" class="easyui-linkbutton" iconCls="icon-add"
                plain="true" onclick="openWin()">修改会员</a></shiro:hasPermission> -->
            <!-- <shiro:hasPermission name="vip:del"><a href="#" class="easyui-linkbutton" iconCls="icon-add"
                plain="true" onclick="openWin()">删除会员</a></shiro:hasPermission> -->
            <shiro:hasPermission name="vip:dongjie">
                <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="del()">冻结会员</a>
            </shiro:hasPermission>
            <shiro:hasPermission name="vip:huifu">
                <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="reset()">恢复会员</a>
            </shiro:hasPermission>
            <select id="state" class="easyui-combobox"
                    data-options="editable:false,panelHeight:'auto'"
                    style="width: 100px;">
                <option value="0">正常</option>
                <option value="1">冻结</option>
            </select> <input id="username" class="easyui-searchbox" data-options="prompt:'请输入会员名',searcher:doSearch"
                             style="width: 200px"></input>
        </div>
    </div>
    <table id="dgVip"></table>
</shiro:hasPermission>
</body>
</html>
<script type="text/javascript">
    function doSearch() {
        var huiyuanming = $("#username").val();
        $("#dgVip").datagrid({
            queryParams: {
                huiyuanming: huiyuanming,
                // jgid: $('#jgid').val(),
                state: $('#state').val()
            }
        })
    }

    $("#dgVip").datagrid({
        url: path + '/vip/list.do',
        method: 'GET',
        toolbar: '#tb',
        fit: true,
        striped: true,
        fitColumns: true,
        singleSelect: true,
        queryParams: {
            state: $('#state').val()
        },
        autoRowHeight: true,
        rownumbers: true,
        pagination: true,
        nowrap: false,
        // height: 400,
        pageSize: 20,
        pageList: [10, 20, 50],
        showFooter: true,
        loadMsg: '加载中,请稍后......',
        columns: [[{
            field: 'huiyuanming',
            title: '会员名称',
            width: 50,
            align: 'center'
        }, {
            field: 'vipzk',
            title: '会员折扣',
            width: 50,
            align: 'center'
        }, {
            field: 'balance',
            title: '余额',
            width: 50,
            align: 'right',
            formatter: function (value) {
                if (value == null) {
                    value = 0
                }
                return value.toFixed(2);
            }
        }, {
            field: 'phone',
            title: '手机号码',
            width: 50,
            align: 'center'
        }, {
            field: 'yue',
            title: '消费金额',
            width: 50,
            align: 'right'
        }, {
            field: 'jifen',
            title: '会员积分',
            width: 50,
            align: 'right'
        }, {
            field: 'shengri',
            title: '会员生日',
            width: 50,
            align: 'center'
        }, {
            field: 'xingbie',
            title: '性别',
            width: 50,
            align: 'center',
            formatter: function (value, row, index) {
                if (value == 0) {
                    return "男";
                }
                return "女";
            }
        }, {
            field: 'state',
            title: '状态',
            width: 50,
            align: 'center',
            formatter: function (value, row, index) {
                if (value == 0) {
                    return "正常";
                } else {
                    return "冻结";
                }
            }
        }]],
        //loadFilter : function(responseData) {
        //	return responseData.data;
        //},
        onBeforeLoad: function (param) {
        },
        onLoadSuccess: function (data) {
            console.debug(data)
        },
        onLoadError: function () {
            //	console.debug('not ok')
        }
    })
    //$('#dg').datagrid('hideColumn', 'id');
    $('#dgVip').datagrid({
        rowStyler: function (index, row) {
            //如果id=000001时，该行隐藏
            if (row.id == -1) {
                return 'display:none';
            }
        }
    });
</script>
